<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>CL-CBS: include/timer.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">CL-CBS
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">timer.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="timer_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#pragma once</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;</div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;chrono&gt;</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div><div class="line"><a name="l00018"></a><span class="lineno"><a class="line" href="classTimer.html">   18</a></span>&#160;<span class="keyword">class </span><a class="code" href="classTimer.html">Timer</a> {</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160; <span class="keyword">public</span>:</div><div class="line"><a name="l00020"></a><span class="lineno"><a class="line" href="classTimer.html#a5f16e8da27d2a5a5242dead46de05d97">   20</a></span>&#160;  <a class="code" href="classTimer.html#a5f16e8da27d2a5a5242dead46de05d97">Timer</a>()</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;      : start_(std::chrono::high_resolution_clock::now()),</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;        end_(std::chrono::high_resolution_clock::now()) {}</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;</div><div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="classTimer.html#a9020542d73357a4eef512eefaf57524b">   24</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classTimer.html#a9020542d73357a4eef512eefaf57524b">reset</a>() { start_ = std::chrono::high_resolution_clock::now(); }</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;</div><div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="classTimer.html#a63f0eb44b27402196590a03781515dba">   26</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classTimer.html#a63f0eb44b27402196590a03781515dba">stop</a>() { end_ = std::chrono::high_resolution_clock::now(); }</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;</div><div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="classTimer.html#a4415a31ce4efa5af7889d91c6eb9dc17">   28</a></span>&#160;  <span class="keywordtype">double</span> <a class="code" href="classTimer.html#a4415a31ce4efa5af7889d91c6eb9dc17">elapsedSeconds</a>()<span class="keyword"> const </span>{</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;    <span class="keyword">auto</span> timeSpan = std::chrono::duration_cast&lt;std::chrono::duration&lt;double&gt;&gt;(</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;        end_ - start_);</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;    <span class="keywordflow">return</span> timeSpan.count();</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;  }</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160; <span class="keyword">private</span>:</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;  std::chrono::high_resolution_clock::time_point start_;</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;  std::chrono::high_resolution_clock::time_point end_;</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;};</div><div class="ttc" id="classTimer_html_a9020542d73357a4eef512eefaf57524b"><div class="ttname"><a href="classTimer.html#a9020542d73357a4eef512eefaf57524b">Timer::reset</a></div><div class="ttdeci">void reset()</div><div class="ttdef"><b>Definition:</b> timer.hpp:24</div></div>
<div class="ttc" id="classTimer_html_a5f16e8da27d2a5a5242dead46de05d97"><div class="ttname"><a href="classTimer.html#a5f16e8da27d2a5a5242dead46de05d97">Timer::Timer</a></div><div class="ttdeci">Timer()</div><div class="ttdef"><b>Definition:</b> timer.hpp:20</div></div>
<div class="ttc" id="classTimer_html"><div class="ttname"><a href="classTimer.html">Timer</a></div><div class="ttdoc">class for counting time (microsecond) </div><div class="ttdef"><b>Definition:</b> timer.hpp:18</div></div>
<div class="ttc" id="classTimer_html_a63f0eb44b27402196590a03781515dba"><div class="ttname"><a href="classTimer.html#a63f0eb44b27402196590a03781515dba">Timer::stop</a></div><div class="ttdeci">void stop()</div><div class="ttdef"><b>Definition:</b> timer.hpp:26</div></div>
<div class="ttc" id="classTimer_html_a4415a31ce4efa5af7889d91c6eb9dc17"><div class="ttname"><a href="classTimer.html#a4415a31ce4efa5af7889d91c6eb9dc17">Timer::elapsedSeconds</a></div><div class="ttdeci">double elapsedSeconds() const </div><div class="ttdef"><b>Definition:</b> timer.hpp:28</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
